package com.edu.dao.impl;

import com.edu.dao.MyBatisUtil;
import com.edu.dao.NewsMapper;
import com.edu.data.News;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class MyBatisNewsDaoImpl implements NewsMapper {
    SqlSession sqlSession= MyBatisUtil.createSession();
    NewsMapper newsMapper = sqlSession.getMapper(NewsMapper.class);

    @Override
    public int deleteByPrimaryKey(Integer enId) {
        return 0;
    }

    @Override
    public int insert(News record) {
        return 0;
    }

    @Override
    public int insertSelective(News record) {
        return 0;
    }

    @Override
    public News selectByPrimaryKey(Integer enId) {
        return null;
    }

    @Override
    public int updateByPrimaryKeySelective(News record) {
        return 0;
    }

    @Override
    public int updateByPrimaryKey(News record) {
        return 0;
    }

    @Override
    public List<News> getAllNews() {
        List<News> newsList = newsMapper.getAllNews();
        return newsList;
    }

    public static void main(String[] args){
        MyBatisNewsDaoImpl dao = new MyBatisNewsDaoImpl();
        //获取所有联系人
        List<News> news = dao.getAllNews();
        System.out.println(news.size());
    }
}
